<script setup>
defineProps({
  plant: {
    type: Object,
    required: true
  }
})
</script>

<template>
  <div class="plant-card">
    <div class="plant-image">
      <img :src="plant.image" :alt="plant.name">
      <div class="plant-level">Lv.{{ plant.level }}</div>
    </div>
    <div class="plant-info">
      <h3>{{ plant.name }}</h3>
      <p class="species">{{ plant.species }}</p>
      <div class="status-bars">
        <div class="status-item">
          <span>健康度</span>
          <div class="progress-bar">
            <div class="progress" :style="{ width: plant.health + '%', backgroundColor: '#42b983' }"></div>
          </div>
        </div>
        <div class="status-item">
          <span>水分</span>
          <div class="progress-bar">
            <div class="progress" :style="{ width: plant.water + '%', backgroundColor: '#4a90e2' }"></div>
          </div>
        </div>
        <div class="status-item">
          <span>光照</span>
          <div class="progress-bar">
            <div class="progress" :style="{ width: plant.light + '%', backgroundColor: '#f1c40f' }"></div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped>
.plant-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease;
  cursor: pointer;
}

.plant-card:hover {
  transform: translateY(-4px);
}

.plant-image {
  position: relative;
  height: 200px;
  overflow: hidden;
}

.plant-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.plant-level {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
}

.plant-info {
  padding: 16px;
}

.plant-info h3 {
  margin: 0;
  font-size: 18px;
  color: #2c3e50;
}

.species {
  color: #666;
  font-size: 14px;
  margin: 4px 0 12px;
}

.status-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.status-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #666;
}

.progress-bar {
  flex: 1;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
}

.progress {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
</style> 